﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Configuration;

using Microsoft.Practices.EnterpriseLibrary.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;

namespace SmallERP.DAL.PrintManage
{
    public class BoardDAL
    {



        public static List<int> GetListBoardId(string customerName)
        {
            string sql = string.Format("select distinct d.BoardId from orderInfo a,photoINfo b,picmakeup c,board d where a.orderproductid =b.orderproductid and b.photoid =c.photoid and c.boardid =d.boardid and a.ordername like'%{0}%' ", customerName);
            return DataBaseAccess(sql);
        }

        private static List<int> DataBaseAccess(string sqlstr)
        {
            List<int> list = new List<int>();
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand cmd = db.GetSqlStringCommand(sqlstr);
            IDataReader rdr = db.ExecuteReader(cmd);
            while (rdr.Read())
            {
                list.Add( rdr.GetInt32(0));
            }
            return list;
        }

    }

}
